package com.lyj.mode.single;


/**
 * 双重检查锁机制
 * @author:liyajie
 * @createTime:2022/2/10 15:50
 * @version:1.0
 */
public class Singleton6 {
    // 私有化构造方法
    private Singleton6(){}

    // 内部属性
    private volatile static Singleton6 singleton6;

    // 对外提供公共方法
    public static Singleton6 getSingleton6(){
        if (singleton6 == null){
            synchronized (Singleton6.class){
                if(singleton6 == null){
                    singleton6 = new Singleton6();
                }
            }
        }
        return singleton6;
    }
}
